@extends('layouts.default') @section('main')
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <link rel="stylesheet" href="/css/chosen.css" />
    <script type="text/javascript" src="{{URL::asset('js/')}}/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="{{URL::asset('js/')}}/common.js"></script>
    <div id="content">
        <div id="content-header">
            <div id="breadcrumb">
                <a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
                            class="icon-home"></i> 首页</a>
                <a href="{{url('user/index')}}" class="tip-bottom">会员管理</a>
                <a href="#" class="current">会员信息修改</a>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span9">
                    <div class="widget-box">
                        <div class="widget-title">
						<span class="icon"> <i class="icon-align-justify"></i>
						</span>
                            <h5>基础信息</h5>
                        </div>
                        <div class="widget-content nopadding">
                            <form action="{{url('user/edit-info')}}" method="post" id="adForm" class="form-horizontal">
                                <div class="control-group">
                                    <label class="control-label">会员ID :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="uid" value="{{$userInfo->uid}}" readonly="readonly" placeholder="会员ID" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>会员昵称 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="nickname" value="{{$userInfo->nickname}}" placeholder="会员昵称"  />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>会员姓名 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="realname" value="{{$userInfo->realname}}"  placeholder="姓名" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>会员username :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="username" value="{{$userInfo->username}}"  placeholder="username" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">会员头像 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="avatar"
                                               placeholder="点击右边小图标上传" value="{{$userInfo->avatar}}" />
                                        <img  src="{{getImage($userInfo->avatar)}}"  width="120px" name="avatar" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadWxphotoBtn"   onclick="javascript:openBrowse('uploadWxphotoBtn','uploadWxphoto');">点击上传(图片大小不小于h:320像素×w:320像素)</a>
                                        <input type="file" id="uploadWxphoto" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadWxphoto','avatar')"/>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">新密码（可以不填） :</label>
                                    <div class="controls">
                                        <input type="password" class="span11" name="newPassword"
                                               placeholder="新密码（可以不填，填了就要和下面的输入框保持一致）" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">重复密码 :</label>
                                    <div class="controls">
                                        <input type="password" class="span11" name="rePassword"
                                               placeholder="确认新密码" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">当前角色 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="real" value="@if($userInfo->roleUser){{$userInfo->roleUser->role->name}}@endif"  readonly="readonly" />
                                    </div>
                                </div>
                                <div class="control-group">
                                <label class="control-label"><span class="redD">*</span>状态 :</label>
                                <div class="controls">
                                    <input type="radio"  name="status"  value="1" @if($userInfo->status==1)checked="checked"@endif/>正常
                                    <input type="radio"  name="status"  value="0" @if($userInfo->status==0)checked="checked"@endif/>未激活
                                    <input type="radio"  name="status"  value="-1" @if($userInfo->status==-1)checked="checked"@endif/>禁用
                                    <input type="radio"  name="status"  value="2" @if($userInfo->status==2)checked="checked"@endif/>可以登录，但在前台不显示
                                </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>关注的行业(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="关注的行业（多选）" class="chzn-select" name="followIndustry[]" multiple style="width:600px;" tabindex="4" id="dl_chose2">
                                            @foreach($lists as $list)
                                                <option value="{{$list->id}}" @if(in_array($list->id,$userCategoryIds)) selected @endif>{{$list->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                @if($userInfo->roleUser->role->name == '普通用户' ||$userInfo->roleUser->role->name == '创客空间')
                                       <input type="hidden" class="span11" name="formType" value="baseEdit" />
                                    <div class="control-group">
                                        <label class="control-label">个性签名 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="sign" value="@if($userInfo->userInfo){{$userInfo->userInfo->sign}}@endif" placeholder="个性签名" />
                                        </div>
                                    </div>
                                    <div class="control-group">
                                        <label class="control-label">一句话简介 :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="introduction" value="@if($userInfo->userInfo){{$userInfo->userInfo->introduction}}@endif" placeholder="一句话简介" />
                                        </div>
                                    </div>
                                @endif
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>所在地区 :</label>
                                    <div class="controls">
                                        <select name="province_id" id="city">
                                            <option value="">省份</option>
                                            @foreach($zoneTree as $zone)
                                                <option value="{{$zone['id']}}" @if(isset($family[1]) && $family[1]['id'] == $zone['id']) selected="selected" @endif>{{$zone['name']}}</option>
                                            @endforeach
                                        </select>
                                        <select name="zone_id" id="zone">
                                            <option value="@if(isset($family[0])){{$family[0]['id']}}@endif">@if(isset($family[0])){{$family[0]['name']}}@else城市@endif</option>

                                        </select>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">详细地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="address" value="@if($userInfo->userInfo){{$userInfo->userInfo->address}}@endif" placeholder="会员地址" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>邮箱 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="email" value="{{$userInfo->email}}" placeholder="邮箱" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="zipcode" value="@if($userInfo->userInfo){{$userInfo->userInfo->zipcode}}@endif" placeholder="邮编" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">上传新的个人名片 :</label>
                                    <div class="controls">
                                        <input type="hidden" class="span11" name="business_card"
                                               placeholder="点击右边小图标上传" @if($userInfo->userInfo)value="{{$userInfo->userInfo->business_card}}"@endif />
                                        <img  @if($userInfo->userInfo) src="{{getImage($userInfo->userInfo->business_card)}}" @endif width="120px" name="business_card" height="120px"/>

                                        <a href="javascript:void(0);" id="uploadCardBtn"  onclick="javascript:openBrowse('uploadCardBtn','uploadCard');">点击上传</a>
                                        <input type="file" id="uploadCard" style="display:none" name="myfile" size="10" onchange="fileUpload('uploadCard','business_card')"/>
                                    </div>
                                </div>

                                @if($userInfo->roleUser->role->name == '投资人')
                                <div class="widget-title">
                                    <span class="icon"> <i class="icon-align-justify"></i></span>
                                    <h5>投资信息</h5>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">个性签名 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="sign" value="@if($userInfo->userInfo){{$userInfo->userInfo->sign}}@endif" placeholder="个性签名" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>一句话简介 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="introduction" value="@if($userInfo->userInfo){{$userInfo->userInfo->introduction}}@endif" placeholder="一句话简介" />
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>主投方向(多选) :</label>
                                    <div class="controls">
                                        <select data-placeholder="主投方向（多选）" class="chzn-select" name="investIndustry[]" multiple style="width:605px;" tabindex="4" id="dl_chose1">
                                            @foreach($lists as $list)
                                                <option value="{{$list->id}}" @if(in_array($list->id,$userInvestCategoryIds)) selected @endif>{{$list->name}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>投资经历 :</label>
                                    <div class="controls">
                                        <textarea  class="textarea_editor span11" rows="5" name="investCase" >@if($userInfo->userInfo){{$userInfo->userInfo->investCase}}@endif</textarea>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>投资机构名 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="institution_name" value="@if($userInfo->userInfo){{$userInfo->userInfo->institution_name}}@endif" placeholder="投资机构名" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>职务 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="job" value="@if($userInfo->userInfo){{$userInfo->userInfo->job}}@endif" placeholder="投资人职务" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">电话 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="tel" value="@if($userInfo->userInfo){{$userInfo->userInfo->tel}}@endif" placeholder="电话" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">传真 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="fax" value="@if($userInfo->userInfo){{$userInfo->userInfo->fax}}@endif" placeholder="传真" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>机构地址 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="office_address" value="@if($userInfo->userInfo){{$userInfo->userInfo->office_address}}@endif" placeholder="机构地址" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">机构邮编 :</label>
                                    <div class="controls">
                                        <input type="text" class="span11" name="office_zipcode" value="@if($userInfo->userInfo){{$userInfo->userInfo->office_zipcode}}@endif" placeholder="机构邮编" />
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"><span class="redD">*</span>是否推荐 :</label>
                                    <div class="controls">
                                        <input type="radio"  name="recommend"  value="1" @if($userInfo->recommend==1)checked="checked"@endif/>推荐
                                        <input type="radio"  name="recommend"  value="0" @if($userInfo->recommend==0)checked="checked"@endif/>不推荐
                                    </div>
                                </div>

                                    <div class="control-group">
                                        <label class="control-label">投资金额最小值(单位,万元) :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="fund_min"   placeholder="投资金额最小值(单位,万元)" value="{{$userInfo->fund_min/10000}}" />
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label">投资金额最大值(单位,万元) :</label>
                                        <div class="controls">
                                            <input type="text" class="span11" name="fund_max"   placeholder="投资金额最大值(单位,万元)" value="{{$userInfo->fund_max/10000}}" />
                                        </div>
                                    </div>

                                    <div class="control-group">
                                        <label class="control-label">投资轮次偏好(多选) :</label>
                                        <div class="controls">
                                            <select data-placeholder="投资轮次偏好（多选）" class="chzn-select" name="invest_project_period[]" multiple style="width:605px;" tabindex="4" id="dl_chose1">
                                                @foreach($types as $k=>$v)
                                                    <option value="{{$k}}" @if(in_array($k,$invest_project_period)) selected @endif>{{$v}}</option>
                                                @endforeach
                                            </select>
                                        </div>
                                    </div>


                                <label class="control-label">直通车状态 :</label>
                                <div class="controls">
                                    <select  name="status" class="span11" disabled="disabled" >
                                        <option value="{{$userInfo->is_ztc}}">@if($userInfo->is_ztc == 1)已开通@else未开通@endif</option>
                                    </select>
                                </div>
                                        <input type="hidden" class="span11" name="formType" value="investEdit" />
                                @endif
                                <div class="form-actions">
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <button type="button" id="doSave" class="btn btn-success">确认修改</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(document).ready(function(){
            //初始化
            $(".chzn-select").chosen();

        });

        $("#doSave").click(function(){
            ajaxRequest($('#adForm').serializeArray(),$('#adForm').attr('action'),function(data){
                if(data.status){
                    alert(data.message);
                    window.location.href = data.forwardUrl;
                }else{
                    alert(data.message);
                }
            });
        });

        $("#city").change(function() {
            $("#zone").empty();
            $.post("{{url('zone/children')}}", {
                id: $(this).val()
            }, function(data) {
                if (data.status) {
                    var html = '<option value="">城市</option>';
                    $.each(data.message, function(i, n) {
                        html += "<option value='"+n.id+"'>"+n.name+"</option>";
                    });
                    $("#zone").html(html);
                }
            }, 'json');
        });

    </script>
@stop
